function g(id) {  //与jQuery冲突 $改为g
	return document.getElementById(id);
}
/**
 * Employee_detail.jsp 修改个人信息页面js
 */
function checkInfo() {
	var address = g('address').value;
	var birthday = g('birthday').value;
	var phone = g('phone').value;
	var email = g("email").value;
	var officetTel = g("officetTel").value;
	var checkEmail = /^([\w_\.\-])+@\w+(\.[a-zA-Z]{2,3}){1,2}$/;

	//文本框为空,禁用提交按钮
	if (birthday =="") {
		g("submitBtn").disabled = true;
		return false;
	} else {
		g("submitBtn").disabled = false;
	}
	
	//办公电话
	if (officetTel == "") {
		g("lblofficetTel").innerHTML = "<font color='red' > ×办公电话不能为空</font>";
		g("submitBtn").disabled = true;
		return false;
	} else {
		g("lblofficetTel").innerHTML = "";
		g("submitBtn").disabled = false;
	}
	//手机非空验证
	if (isNaN(phone) || phone.length != 11 || phone == "") {
		g("lblPhone").innerHTML = "<font color='red' > ×电话号码不能为空,且必须为11数字</font>";
		g("submitBtn").disabled = true;
		return false;
	} else {
		g("lblPhone").innerHTML = "";
		g("submitBtn").disabled = false;
	}

	//地址非空验证
	if (!isNaN(address) || address == "") {
		g("lblAddress").innerHTML = "<font color='red' > ×地址格式不符</font>";
		g("submitBtn").disabled = true;
		return false;
	} else {
		g("lblAddress").innerHTML = "";
		g("submitBtn").disabled = false;
	}
	//邮箱验证
	if (checkEmail.test(email)) {
		g("lblEmail").innerHTML = "";
		g("submitBtn").disabled = false;
	} else {
		g("lblEmail").innerHTML = "<font color='red' > ×邮箱格式不符</font>";
		g("submitBtn").disabled = true;
	}
}

/**
 * Employee_pwd.jsp 修改个人密码js
 */
function checkPwd() {
	var oldPwd = g("oldPwd").value;
	var newPwd = g("newPwd").value;
	var rePwd = g("rePwd").value;
	if (oldPwd == "" || oldPwd != "") {
		g("lblMessage").innerHTML = "";
	}
	if (oldPwd == "" || newPwd == "" || rePwd == ""
			|| (newPwd.length <= 5 || newPwd.length > 20)) {
		g("submitPwd").disabled = true;
	} else if (newPwd != rePwd || newPwd !=rePwd) {
		g("lblRePwd").innerHTML = "两次密码输入不一致";
		g("submitPwd").disabled = true;
	} else {
		g("lblrePwd").innerHTML = "";
		g("submitPwd").disabled = false;
	}
}

//显示明文
function doChange() {
	var changeCbo = g("changeCbo");
	var oldPwd = g('oldPwd').value;
	var newPwd = g('newPwd').value;
	var rePwd = g('rePwd').value;

	if (changeCbo.checked == true) {
		g('spOldPwd').innerHTML = '<input class="input" type="text" id="oldPwd" name="oldPwd" onblur="checkPwd()" size="30"/>';
		g('spNewPwd').innerHTML = '<input class="input" type="text" id="newPwd" name="newPwd"  onkeyup="checkPwd()" size="30"/>';
		g('spRePwd').innerHTML = '<input class="input" type="text" id="rePwd" name="rePwd" onkeyup="checkPwd()" size="30"/>';
	} else {
		g('spOldPwd').innerHTML = '<input class="input" type="password" id="oldPwd" name="oldPwd" onblur="checkPwd()" size="30"/>';
		g('spNewPwd').innerHTML = '<input class="input" type="password"  id="newPwd" name="newPwd" onkeyup="checkPwd()" size="30"/>';
		g('spRePwd').innerHTML = '<input class="input" type="password" id="rePwd" name="rePwd" onkeyup="checkPwd()" size="30"/>';
	}
	g('oldPwd').value = oldPwd;
	g('newPwd').value = newPwd;
	g('rePwd').value = rePwd;

}

/**
 * 报销页面Claim.jsp
 */
function cc(s){
        if(/[^0-9\,\.]/.test(s)){
        	g("lblMoney").innerHTML = "<font color='red' > ×报销金额必须为数字</font>";
        	g("submitClaim").disabled = true;
        	return s;
        }else{
        	g("lblMoney").innerHTML = "";
        }
        s=s.replace(/^(\d*)$/,"$1.");
        s=(s+"00").replace(/(\d*\.\d\d)\d*/,"$1");
        s=s.replace(".",",");
        var re=/(\d)(\d{3},)/;
        while(re.test(s))
                s=s.replace(re,"$1,$2");
        s=s.replace(/,(\d\d)$/,".$1");
        return  s.replace(/^\./,"0.")
        }

function checkClaim() {
	var money = g("money").value;
	var item = g("item").value;
	
 	var money = g("money").value;
	var item = g("item").value;
	if (money == "" ||item == "" || /[^0-9\,\.]/.test(money)) {
		g("lblMoney").innerHTML = "";
		g("submitClaim").disabled = true;
	}else {
		g("submitClaim").disabled = false;
	}
}

/**
 * schedule_me.jsp
 * @return {TypeName} 
 */
function checkDate() {
	var startDate = g("d5221").value;
	var endDate = g("d5222").value;
	if (startDate == "" || endDate == "") {
		g("searchSubmit").disabled = true;
		return;
	}
	g("searchSubmit").disabled = false;
}
